import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'


Vue.use(Vuex)

// 应用初始状态
const state = {
    count: 10,
    change: 1,
    isshowflag: '',
    projectList: [],//项目记录
    size: 0,//项目记录总数量
    deleteSelects: [],//保存要删除的售前项目
    docParentId: '0',//文档类型所属一级目录id，对应于左侧所属类别的id
    documentType: '',//文档类型id,二级目录的id,当选择查询所有不用传递，
    projectName: '',//项目名称
    typeId_: '',
    lineProgressData: '',//任务端数据
    menuId: "",          //一级菜单选择的id
}

// 定义所需的 mutations
const mutations = {
    SET_TYPE_ID(state, data) {
        state.typeId_ = data
    },
    SET_PROJECT_NAME(state, data) {
        state.projectName = data
    },
    INCREMENT(state) {
        state.count++
    },
    DECREMENT(state) {
        state.count--
    },
    add_flag(state, flag) {
        state.isshowflag = flag
    },
    SET_PROJECT_LIST(state, data) {
        state.projectList = data
    },
    SET_SIZE(state, data) {
        state.size = data
    },
    SET_SELECT_DEL(state, data) {
        state.deleteSelects = data
    },
    SET_PARENT_ID(state, data) {
        state.docParentId = data
    },
    SET_DOCUMENT_TYPE(state, data) {
        state.documentType = data
    },
    SET_MENUID(state, data) {
        state.menuId = data
    },
    SET_lineProgressData(state, data) {
        state.lineProgressData = data
    }
}


// 创建 store 实例
export default new Vuex.Store({
    actions,
    getters,
    state,
    mutations,
})
